package com.ruoyi.web.controller.durian;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.durian.service.LlCouponService;
import com.ruoyi.durian.service.LlOrderService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 首页控制器
 *
 * @author ruoyi
 */
@RestController
@RequestMapping("/index")
public class IndexController extends BaseController {

    @Resource
    private LlOrderService llOrderService;

    @Resource
    private LlCouponService llCouponService;

    /**
     * 首页订单数据
     *
     * @return
     */
    @GetMapping("/orderNumInfo")
    public AjaxResult orderNumInfo() {
        return llOrderService.orderNumInfo();
    }

    /**
     * 折线图-一周内交易额
     *
     * @return
     */
    @GetMapping("/priceOnWeek")
    public AjaxResult priceOnWeek() {
        return llOrderService.priceOnWeek();
    }

    /**
     * 饼状图-车型接单占比
     *
     * @return
     */
    @GetMapping("/carTypeOnOrder")
    public AjaxResult carTypeOnOrder() {
        return llOrderService.carTypeOnOrder();
    }

    /**
     * 柱状图-订单状态
     *
     * @return
     */
    @GetMapping("/orderTypeList")
    public AjaxResult orderTypeList() {
        return llOrderService.orderTypeList();
    }

    /**
     * 优惠券发布历史
     *
     * @return
     */
    @GetMapping("/couponSubmitList")
    public TableDataInfo couponSubmitList() {
        startPage();
        return getDataTable(llCouponService.couponSubmitList());
    }
}
